{% extends '@SyliusShop/shared/components/confirmation_modal.html.twig' %}
{% import '@SyliusShop/shared/buttons.html.twig' as buttons %}

{% props id = null, path = null, label = 'sylius.ui.delete', icon = 'tabler:trash', disabled = false, form_attr = null, type = 'delete' %}
{% set modal_id = 'delete-modal-' ~ id %}

{% block trigger %}
    <button type="button" class="btn btn-sm btn-outline-danger" {% if disabled %}disabled {% endif %}data-bs-toggle="modal" data-bs-target="#{{ modal_id }}">
        {{ ux_icon(icon, {'class': 'icon icon-xs'})}} {{ label|trans }}
    </button>
{% endblock %}

{% block footer %}
    <form action="{{ path }}" method="post" {{ form_attr }}>
        <input type="hidden" name="_method" value="DELETE">
        <input type="hidden" name="_csrf_token" value="{{ csrf_token(id) }}" />

        <button type="button" class="btn btn-sm" data-bs-dismiss="modal">
            {{ 'sylius.ui.cancel'|trans }}
        </button>
        <button type="submit" class="btn btn-sm btn-danger" {{ sylius_test_html_attribute('confirm-button') }}>
            {{ label|trans }}
        </button>
    </form>
{% endblock %}
